import http from '@/utils/http'

export function getList() {
    return http({
        url: 'posts',
        method: 'get'
  })
}

export function editItem(id: number,title: string,content: string,status: boolean) {
    return http({
        url: '/posts/'+id,
        method:'patch',
        data: {
            title,
            content,
            status
        }
  })
}

export function deleteItem(id: number) {
    return http({
        url: '/posts/'+id,
        method: 'delete',
        data: {
            id
}
  })
}

export function addItem(title: string,content: string,status: boolean) {
    return http({
        url: '/posts',
        method: 'post',
        data: {
            title,
            content,
            status
}
  })
}